<template>
	<view class=" u-m-t-30">
		<u-toast ref="uToast"></u-toast>
		<view class="container" v-for="(item,index) in agentPolicyCostInfo" :key="index">
			<view class="container__title u-border-bottom u-font-15 u-padding-20">
				{{item.activityName}}
			</view>
			<view class="flex list-item u-padding-20 u-m-t-30">
				<view class="flex-1">
					税点
				</view>
				<view class="flex">
					<view class="bg">{{item.taxPoint}}</view>%
				</view>
			</view>
			<view class="flex list-item u-padding-20 ">
				<view class="flex-1">
					首次激活返现
				</view>
				<view class="flex align-center">

					<u-input :custom-style="inputCustomStyle" v-model="item.activeRecash" type="number" height="50"
						:border="false" />元
				</view>
			</view>
			<view class="flex list-item u-padding-20 ">
				<view class="flex-1">
					重复激活返现
				</view>
				<view class="flex align-center">

					<u-input :custom-style="inputCustomStyle" v-model="item.repeatActiveRecash" type="number"
						height="50" :border="false" />元
				</view>
			</view>
			<view class="flex list-item u-padding-20 ">
				<view class="flex-1">
					达标返现1
				</view>
				<view class="flex align-center">

					<u-input :custom-style="inputCustomStyle" v-model="item.standardRecash1" type="number" height="50"
						:border="false" />元
				</view>

			</view>
			<view class="flex list-item u-padding-20 ">
				<view class="flex-1">
					达标返现2
				</view>
				<view class="flex align-center">

					<u-input :custom-style="inputCustomStyle" v-model="item.standardRecash2" type="number" height="50"
						:border="false" />元
				</view>

			</view>
			<view class="flex list-item u-padding-20 ">
				<view class="flex-1">
					达标返现3
				</view>
				<view class="flex align-center">

					<u-input :custom-style="inputCustomStyle" v-model="item.standardRecash3" type="number" height="50"
						:border="false" />元
				</view>

			</view>
			<view class="flex list-item u-padding-20 ">
				<view class="flex-1">
					sim卡返现1
				</view>
				<view class="flex align-center">

					<u-input :custom-style="inputCustomStyle" v-model="item.flowRecash" type="number" height="50"
						:border="false" />元
				</view>

			</view>
			<view class="flex list-item u-padding-20 ">
				<view class="flex-1">
					sim卡返现2
				</view>
				<view class="flex align-center">

					<u-input :custom-style="inputCustomStyle" v-model="item.flowRecash2" type="number" height="50"
						:border="false" />元
				</view>

			</view>
		</view>
		<u-button class="u-m-t-50 u-margin-20" type="primary" :custom-style="customStyle"
			@click="updateAgentCashBack()">提交</u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {

				inputCustomStyle: {
					backgroundColor: '#f6f6f6',
					borderRadius: '10rpx',
					textAlign: 'center',
					width: '80rpx',

				},
				customStyle: {
					backgroundColor: '#FF8625'
				},
				agentPolicyCostInfo: [],
				flag: null,
				requestBody: {
					agentActivityInfoDtoList: []
				},
				agentNo: ""
			}
		},
		onLoad(options) {
			this.agentPolicyCostInfo = JSON.parse(decodeURIComponent(options.agentPolicyCostInfo));
			this.agentNo = options.agentNo;
		},
		methods: {
			updateAgentCashBack() {
				const _that = this;
				_that.requestBody.agentActivityInfoDtoList = _that.agentPolicyCostInfo;
				console.log("data=" + JSON.stringify(_that.requestBody))
				_that.$zx.user_api.updateAgentCashBack(_that.agentNo, _that.requestBody).then((data) => {
					console.log("data=" + JSON.stringify(data))
					this.$refs.uToast.show({
						title: '修改成功',

					})
					uni.navigateBack({
						delta: 3
					});
				});
			}
		},
	}
</script>

<style scoped lang="scss">
	.container {
		background-color: white;

		&__title {
			font-weight: bold;
		}
	}

	.bg {
		background-color: #f6f6f6;
		height: 50rpx;
		line-height: 50rpx;
		width: 80rpx;
		border-radius: 10rpx;
		text-align: center;
	}

	.list-item {
		// height: 80rpx;
		// line-height: 80rpx;
	}
</style>